package com.omkarpatil.learningjpa2.mapping.onetoone.fk.bidi;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity(name="OtoFkBidiEmployee") @Table(name = "oto_fk_bidi_emp")
public class Employee {
	
	private int id;
	private String name;
	private Desk desk;
	
	public Employee() {}

	public Employee(String name, Desk desk) {
		this.name = name;
		this.desk = desk;
	}

	@Id @GeneratedValue
	public int getId() {
		return id;
	}
	
	private void setId(int id) {
		this.id = id;
	}
	
	@Column(nullable = false, length = 30)
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}

	@OneToOne @JoinColumn(name = "desk_id", unique = true)
	public Desk getDesk() {
		return desk;
	}

	public void setDesk(Desk desk) {
		this.desk = desk;
	}
}
